//
//  JJBaseViewController.swift
//  Weibo
//
//  Created by Adobe on 15/9/27.
//  Copyright © 2015年 龚巨军. All rights reserved.
//

import UIKit

class JJBaseViewController: UITableViewController,JJVisitorViewDelegate {
    
    // 定义一个标记记录当前是否登录
    
    var isLogin :Bool = true
    
    override func loadView() {

        
        // 如果当前是登录,就调用父类,没登录就调用登录视图
        
        isLogin ? super.loadView() : setupVisitorView()
        
        
    }
    
    func setupVisitorView(){
        
        let visitorView = JJVisitorView()
        
        visitorView.delegate = self
        
        view = visitorView

        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Done, target: self, action: nil)
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Done, target: self, action: nil)
    }
    
    func visitorViewDidRegisterBtnClick(visitorView: JJVisitorView) {
        JJLog(__FUNCTION__)
    }
    func visitorViewLoginBtnClick(visitorView: JJVisitorView) {
        JJLog(__FUNCTION__)
    }

}